import com.alibaba.fastjson.JSONPath
import com.share.common.utils.DateUtil
import com.share.common.utils.IdCardUtil
import com.share.common.utils.MockUtil
import org.apache.commons.lang3.StringUtils

public String parseJson(String strJson) {
    try {
        String idCard = JSONPath.read(strJson, '$..idCard[0]')
        if (StringUtils.isBlank(idCard)) {
            idCard = IdCardUtil.gen18();
        }

        String name = JSONPath.read(strJson, '$..name[0]')
        if (StringUtils.isBlank(name)) {
            name = MockUtil.userName();
        }

        String templateUrl = 'http://minio.snyq.ltd:9000/share/template/personAuthorizationFile.pdf';

        String signTime = DateUtil.getDateTime();

        String path = MockUtil.genPersonAuthorizationFile(templateUrl, name, idCard, signTime)
        return path;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
